<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateCustomersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('customers', function(Blueprint $table)
		{
			$table->increments('id');
			$table->string('name', 60)->comment('客户的名称');
			$table->string('legal_person')->nullable()->comment('公司法人');
			$table->string('telephone', 100)->nullable()->comment('公司电话');
			$table->string('contacts')->nullable()->comment('联系人');
			$table->string('phone')->nullable()->comment('联系人电话');
			$table->string('license')->nullable()->comment('营业执照');
			$table->string('water_mark')->nullable()->comment('水印图片');
			$table->string('address')->nullable()->comment('地址');
			$table->float('division_percent')->unsigned()->nullable()->default(0.00)->comment('分成比例');
			$table->integer('authorizer_id')->unsigned()->default(0)->comment('关联authorizers表，对应的公众号ID');
			$table->integer('youzan_authorizer_id')->default(0)->comment('关联youzan_authorizers表');
			$table->boolean('provider_type')->default(2)->comment('商户类型 1 虚拟供应商 2 普通客户 3 购买软件的客户');
			$table->boolean('show_virtual')->default(1)->comment('显示虚拟仓产品，0：关闭，1：开启');
			$table->boolean('has_hair')->default(0)->comment('是否开通发型试戴 0：未开通。1：开通');
			$table->boolean('has_youzan')->default(0)->comment('是否有有赞商城');
			$table->boolean('is_deleted')->default(0)->comment('是否开启或者禁用 代理客户 0：开启，1：禁用');
			$table->integer('dev_acnt_num')->default(0)->comment('DeviceAccountNumber 设备账号数量限制， 购买软件的客户开通时需要设置');
			$table->string('province')->nullable()->comment('省');
			$table->string('city')->nullable()->comment('市');
			$table->string('district')->nullable()->comment('区');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('customers');
	}

}
